UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XQCxo9RrBEYPZrZnTVzbTZfLImRyt+VLgK2vScoq+YY='
WHERE
key_id = '9051ec6e5eea66748e51373d97cd56d8a4606ea1e334c1dcfed7f567edcdd23f'
AND (
token = 'XQCxo9RrBEYPZrZnTVzbTZfLImRyt+VLgK2vScoq+YY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)