UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YZmvzapOp70CCMEJAb83I8rxzLBqXvj0eoXsS8lEvV0='
WHERE
key_id = '05b60c566975893bf1e4da080936b8761607e977db13abf0a78403a0a972f0f9'
AND (
token = 'YZmvzapOp70CCMEJAb83I8rxzLBqXvj0eoXsS8lEvV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)