UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O5qmK7vtRweCjWsLot1bq8o7XBxLPtntwEuwVl62y7Y='
WHERE
key_id = '76ba340e2b397096be682e916602a4b13202aba6ebc7ed6403e291261314ebf3'
AND (
token = 'O5qmK7vtRweCjWsLot1bq8o7XBxLPtntwEuwVl62y7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)