UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QnPtfxDTDVv0xa0Jd2IyvcktTOIN98bo+xvRaloYpww='
WHERE
key_id = 'bbe728444b06688ee73822488a0223eafeda39e4b0961d57c547625e4ddbbc88'
AND (
token = 'QnPtfxDTDVv0xa0Jd2IyvcktTOIN98bo+xvRaloYpww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)