UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CHxX4q98ojrCGo5IMmBeIisBN8S7KLCOwIsDv+dtTjc='
WHERE
key_id = 'cf4106532d076d42061907a55f83e1c667c344b29fe1c6bc3be6bbd0b80c1452'
AND (
token = 'CHxX4q98ojrCGo5IMmBeIisBN8S7KLCOwIsDv+dtTjc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)