UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQ+ZHHuIFtqgfG0XeHc557Tmy5V27VW7eYIDxNwZCzk=' 
WHERE 
  key_id = 'b737c06b42acd4e13e40ccf53cf768172938e11ac4ebd3cee49a96001905011e' 
  AND (
    token = 'BQ+ZHHuIFtqgfG0XeHc557Tmy5V27VW7eYIDxNwZCzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048