UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ba5J10gGy0a8l8/hk4zOpE5iDd2p+r9wsIfM53FfkIQ=' 
WHERE 
  key_id = '28279d77da3e04a40e69a92b8b871cd5db3afbb9055b4f393dc6df454e1ba0a1' 
  AND (
    token = 'ba5J10gGy0a8l8/hk4zOpE5iDd2p+r9wsIfM53FfkIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047