UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X6TIwOTUrs2R/qaKAxPstIMhZiuBTx5GYGs6GiTIMmY='
WHERE
key_id = '564f3026ba34654671ab8b14568b1584ca6f3ff2ccfc16718710881c17363d9e'
AND (
token = 'X6TIwOTUrs2R/qaKAxPstIMhZiuBTx5GYGs6GiTIMmY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)