UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UYKtLAK/oNmDcw3WPZUh16THT0vGB3gR/0rTOCgTHqw='
WHERE
key_id = 'ea912d66fc6ea9bbf6c7bb691cc95818f131313642144beafa573c011ff64dc7'
AND (
token = 'UYKtLAK/oNmDcw3WPZUh16THT0vGB3gR/0rTOCgTHqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)