UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Krou5ayRHrn2Y09rnlRrKTeKlWfGJMHQUy2Df23B9ww='
WHERE
key_id = 'f292da58c3aca567b4b76e47297dd53501f8da6fa6d10dbbdb6fda6d463d6774'
AND (
token = 'Krou5ayRHrn2Y09rnlRrKTeKlWfGJMHQUy2Df23B9ww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)