UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PPiqICgGXP1hpWONjjXBym/3vUavHx+WYpTARKdutVQ=' 
WHERE 
  key_id = '247c844f3f90cee7de953b6b05a75645af177128e61fecce3832918ace932939' 
  AND (
    token = 'PPiqICgGXP1hpWONjjXBym/3vUavHx+WYpTARKdutVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029