UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ngYnJglSXnJBiKXtHZPyKId7JzQ3bdHoZFatUaJYsyc='
WHERE
key_id = '8e122bd5c046a71b8dfe0ac056e98cbd7fdfd94b7a4069d17e5595f9ed632fc5'
AND (
token = 'ngYnJglSXnJBiKXtHZPyKId7JzQ3bdHoZFatUaJYsyc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)