UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tlUPPvuGnzporrFpkqty80+g82nD7+SFSictJ/afvRU='
WHERE
key_id = '7a9f8ae36efbe36bc608449c1a60e11a094734149f21920f90f143e9334f6138'
AND (
token = 'tlUPPvuGnzporrFpkqty80+g82nD7+SFSictJ/afvRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)