UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKtEe0v9yPgE5Yaip3w/WYifNcQWj8eP3Dukw7vnklI='
WHERE
key_id = '915c7c7abae5335d5ff243d9850085d2fa286de625c69fd9bec57760c2e75a5e'
AND (
token = 'BKtEe0v9yPgE5Yaip3w/WYifNcQWj8eP3Dukw7vnklI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)