UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kT+RyMRTEuVP3se97gdOnDMNhfQYGe6mhn4aPPkQQ6o=' 
WHERE 
  key_id = '7b85a9116a583320d4eef08f231f4c1783f4a63cd165f803f0a35b77f5609ed0' 
  AND (
    token = 'kT+RyMRTEuVP3se97gdOnDMNhfQYGe6mhn4aPPkQQ6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034