UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CJLFwX09i56tQyGfpesPawrYjYx3+kQ9GodGy5AvHGo=' 
WHERE 
  key_id = '277cc974c8abbc312ae84739a545cf7aecb01fe98e31265e131faaa2329cbd88' 
  AND (
    token = 'CJLFwX09i56tQyGfpesPawrYjYx3+kQ9GodGy5AvHGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028