UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q6aAltiIdJTCIGHRWQD6+qAP4Sf7S4j1XuSda+CgMGI='
WHERE
key_id = 'a1cb33352aec52f4b7417f80533786a118d289cd4788a3694a3a26d160b759d6'
AND (
token = 'Q6aAltiIdJTCIGHRWQD6+qAP4Sf7S4j1XuSda+CgMGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)