UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XCfbbvFk6qrKdagrUdYdVxhVU/PshiO7gvkn6gqzTTI='
WHERE
key_id = 'a6e924807aa98e1d6965143c54a40c87d098284234856e6aa962c8ed6d2c004c'
AND (
token = 'XCfbbvFk6qrKdagrUdYdVxhVU/PshiO7gvkn6gqzTTI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)