UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TnNuLLeqcnmmDCSF9cGE87B2zxk1ikN28FR4fRX/EBc='
WHERE
key_id = 'd1424a9681cad3c5ce61edd5438396e0510bb060d4267c2d749609587017272a'
AND (
token = 'TnNuLLeqcnmmDCSF9cGE87B2zxk1ikN28FR4fRX/EBc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)