UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jts1yCVEGK2xWOEyvL16nV8fQE5PlK7b+euYpjz/nX0='
WHERE
key_id = '8c064c2274f28e5a0d419e1ae55cb9c0d3c941a7b0dc6ffad611b9ad5bef4a32'
AND (
token = 'jts1yCVEGK2xWOEyvL16nV8fQE5PlK7b+euYpjz/nX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)