UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QjgjjYa05BWt6L/2C8ADXc5Wvl8L2TJoOLhXzHW5g3g='
WHERE
key_id = 'e80b0fa2e54c9f9d4f0c1ff06deb637b7a313f71460eb665f59b9cf7e45eb188'
AND (
token = 'QjgjjYa05BWt6L/2C8ADXc5Wvl8L2TJoOLhXzHW5g3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)