UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rgrkAQMsy9Ufs0iAdSQO6+6hVhChm55fP54cViH/ARQ='
WHERE
key_id = 'b881368766378df803ab5c7f6755ce6f49fcd474579626e043b9f1ef1e99ca4d'
AND (
token = 'rgrkAQMsy9Ufs0iAdSQO6+6hVhChm55fP54cViH/ARQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)