UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HaNLsf312JC1clex4VolvF8d6P+9MOUQDLUFpGoRIiw=' 
WHERE 
  key_id = '2e8b94dd87b7830c0731319c3243935a644555a9dc65343c22e8b5a0741daf59' 
  AND (
    token = 'HaNLsf312JC1clex4VolvF8d6P+9MOUQDLUFpGoRIiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043