UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KgtKqIEuuoQNEK54OEYFW646759jQ4OMYn5YgKOX8IM=' 
WHERE 
  key_id = 'f2780309accba8aba98fd6ef2a4bd6ad1caf5a9c12e150214d49bd180f1af219' 
  AND (
    token = 'KgtKqIEuuoQNEK54OEYFW646759jQ4OMYn5YgKOX8IM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034