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