UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2sJb1+/WkaPbaxsynnd2BbE20vegtLK0j/dQdiJkJg='
WHERE
key_id = '45f516863768f6b9461198ebc3a502ce282bdfeb4750d9a848f1f84f8463619b'
AND (
token = 'Z2sJb1+/WkaPbaxsynnd2BbE20vegtLK0j/dQdiJkJg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)