UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'APOzBFCKXFt1MTyvebHZG74e//3+RuDSuLwyj8fqr4Q='
WHERE
key_id = 'c152493ed786276feef48a022a0a82bff6382e1241b3dc851bd9c20a8adb15d5'
AND (
token = 'APOzBFCKXFt1MTyvebHZG74e//3+RuDSuLwyj8fqr4Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)