UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jI4eDwT6ld+ovRIkYLUi2w5XiJiLE7Qcep/XG7zefMc='
WHERE
key_id = 'd5831c119ecd5dfe6300b8a7997229c48f1c1e3352a6b2c76504cdb0ab70819a'
AND (
token = 'jI4eDwT6ld+ovRIkYLUi2w5XiJiLE7Qcep/XG7zefMc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)