UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZCQyyv0Iut+ESb3uDk5VC8+a4pSHTxP7GVZYbS4QWx0='
WHERE
key_id = '13a5d03ae44716357ad2c66f5672a89c18cda70c7e038817871de0ad4b88f909'
AND (
token = 'ZCQyyv0Iut+ESb3uDk5VC8+a4pSHTxP7GVZYbS4QWx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)