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

Query time 0.00028