UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v9+uA0oosjsNSZydXx6AQ/i+7Kh3ZJ4JUjZ6HBdy8lM=' 
WHERE 
  key_id = 'f02e12b7683dab9eb25acec9d293dacc952e2d8c9a4d805a0882826276782866' 
  AND (
    token = 'v9+uA0oosjsNSZydXx6AQ/i+7Kh3ZJ4JUjZ6HBdy8lM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049