UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xAMNHDjuma+k7H0ZZI8t1RBBtTAAArUE4AJFb30wiDY='
WHERE
key_id = '4dd893f1f02e97b3a7ed7a4019cbff70aafb8cf184b1ec4c2411ede0b5a540ee'
AND (
token = 'xAMNHDjuma+k7H0ZZI8t1RBBtTAAArUE4AJFb30wiDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)