UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jhiQTXc1d7h17hieWmKeY6CCHroghQ3AlRRX/MekR70='
WHERE
key_id = '052b42573368275fc4af06aa8bb63c98c1fd4e666510a8d9ec40f2900b1e0b18'
AND (
token = 'jhiQTXc1d7h17hieWmKeY6CCHroghQ3AlRRX/MekR70='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)