UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iL1FXqcbAeX4wyiMkojc32HV+SnAieuQRnHWUB4U9t4='
WHERE
key_id = '5b226eeb4989968cda6a4155d23de5504ea3652224d6d030a86b1ac5cc32ac45'
AND (
token = 'iL1FXqcbAeX4wyiMkojc32HV+SnAieuQRnHWUB4U9t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)