UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZNHlvoP3kHsELEXayfEBNiEa/oWhi8FYJI11htWYbHY='
WHERE
key_id = '2d3d9fd1897b5be2387980c9446604dea7a66e5d07f5495e555b1c329b657d2b'
AND (
token = 'ZNHlvoP3kHsELEXayfEBNiEa/oWhi8FYJI11htWYbHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)