UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3tr417CdbVFKEUtK9Fb5/K5/ZGPPLLe+q53bCqsUz+U='
WHERE
key_id = 'c252bd5804f1f868c6f5e938924a5b169484ecafc8b8644161ab34a956909c32'
AND (
token = '3tr417CdbVFKEUtK9Fb5/K5/ZGPPLLe+q53bCqsUz+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)