UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DFvF0v+sJnhGx8dNiAvituMpfXmyD9Jr+yklJuLOyR0='
WHERE
key_id = 'b82245be513e8e988b8c371c3633b80b214c7c5e83286ad488b7c3471e982a15'
AND (
token = 'DFvF0v+sJnhGx8dNiAvituMpfXmyD9Jr+yklJuLOyR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)