UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iiLfOhnhWZEedtKUd/Nag3mcofJQqKgnsKnkez0knj0=' 
WHERE 
  key_id = '4eff60f890ebf8975ef25f200cb3051ec77b77689b8fe18b147474f7034717b1' 
  AND (
    token = 'iiLfOhnhWZEedtKUd/Nag3mcofJQqKgnsKnkez0knj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037