UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0tho532Tk19guzvb32GrcAhUFEAsk25KsW3kKfjOSRU='
WHERE
key_id = '9e561a6c22d1a80a960e5110422b83279853a4c646a5edf8963ba16d15abacf1'
AND (
token = '0tho532Tk19guzvb32GrcAhUFEAsk25KsW3kKfjOSRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)