UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PBwUTiWttXfuG8HSvyGWnQ4WbTdR2zAz7SNdC9esHwc='
WHERE
key_id = 'b01b20e71caa545621b2f3fcb8aa7e30a3c4146895f0d92651e5fb3faa7dca19'
AND (
token = 'PBwUTiWttXfuG8HSvyGWnQ4WbTdR2zAz7SNdC9esHwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)