UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ta6MPA1mEOBaw+5lm8cVeZuEUQocnY4w66RX3QItZwk='
WHERE
key_id = '1c629b7453434584d148ef68040118dbb5bea6b4d4432b63e2381c0c1fd5b4e1'
AND (
token = 'ta6MPA1mEOBaw+5lm8cVeZuEUQocnY4w66RX3QItZwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)