UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M4dcxctVvRmNFJsD7FV1AbCtV9ou1XLJCqn2M6zatSI='
WHERE
key_id = '267a3d2cf32127b2382518d3fbb87b1bc518fb1eedc04c2e90691ec4827ecc31'
AND (
token = 'M4dcxctVvRmNFJsD7FV1AbCtV9ou1XLJCqn2M6zatSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)