UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qnNXikGwx4FYPHm63WO+vVma/sG/5y3efvXopC63fm0='
WHERE
key_id = '6af44269c0980443eea4a6730fa55eab1adf292c23f1e92b6445cbc7ad1d1855'
AND (
token = 'qnNXikGwx4FYPHm63WO+vVma/sG/5y3efvXopC63fm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)