UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KZBE0Vfnq7/7BlsJOw7DhUz0OB6/lH29zpS1Bo5nZVQ=' 
WHERE 
  key_id = 'f2cd85619fd55f8a9ae18ffe4cf12205aee9fe03ae658cc559bf2d6329ee6dca' 
  AND (
    token = 'KZBE0Vfnq7/7BlsJOw7DhUz0OB6/lH29zpS1Bo5nZVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047