UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lO9rmWuzDFXUz4A+F0FVNPTuEvYLaub/1jyWP3KItoc='
WHERE
key_id = 'b035a5191ee934dc69f5c087f1c1c8e0ec235177851f68e31d2ee44eed078044'
AND (
token = 'lO9rmWuzDFXUz4A+F0FVNPTuEvYLaub/1jyWP3KItoc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)