UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HyexIeZvvnIuB/7CJczYxtvJIGX/ebxnDBOQvgprIOM=' 
WHERE 
  key_id = '58053891626605bff6d4990e31acd3b5f4d968829d7414386c2c6a2720ec8776' 
  AND (
    token = 'HyexIeZvvnIuB/7CJczYxtvJIGX/ebxnDBOQvgprIOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057